package com.ruoyi.swimming.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.swimming.domian.CourseCoach;
import com.ruoyi.swimming.domian.CourseSchedule;
import com.ruoyi.swimming.mapper.CourseCoachMapper;
import com.ruoyi.swimming.mapper.CourseScheduleMapper;
import com.ruoyi.swimming.service.ICourseScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * 课程排课Service业务层处理
 * 
 * @author ruoyi
 * @date 2021-07-17
 */
@Service
public class CourseScheduleServiceImpl extends ServiceImpl<CourseScheduleMapper, CourseSchedule> implements ICourseScheduleService
{
    @Autowired
    private CourseScheduleMapper courseScheduleMapper;

    /**
     * 查询课程排课
     * 
     * @param id 课程排课ID
     * @return 课程排课
     */
    @Override
    public CourseSchedule selectCourseScheduleById(Long id)
    {
        return courseScheduleMapper.selectCourseScheduleById(id);
    }

    /**
     * 查询课程排课列表
     * 
     * @param courseSchedule 课程排课
     * @return 课程排课
     */
    @Override
    public List<CourseSchedule> selectCourseScheduleList(CourseSchedule courseSchedule)
    {
        return courseScheduleMapper.selectCourseScheduleList(courseSchedule);
    }

    /**
     * 新增课程排课
     * 
     * @param courseSchedule 课程排课
     * @return 结果
     */
    @Override
    public int insertCourseSchedule(CourseSchedule courseSchedule)
    {
        courseSchedule.setCreateTime(DateUtils.getNowDate());
        return courseScheduleMapper.insert(courseSchedule);
    }

    /**
     * 修改课程排课
     * 
     * @param courseSchedule 课程排课
     * @return 结果
     */
    @Override
    public int updateCourseSchedule(CourseSchedule courseSchedule)
    {
        courseSchedule.setUpdateTime(DateUtils.getNowDate());
        return courseScheduleMapper.updateById(courseSchedule);
    }

    /**
     * 批量删除课程排课
     * 
     * @param ids 需要删除的课程排课ID
     * @return 结果
     */
    @Override
    public int deleteCourseScheduleByIds(Long[] ids)
    {
        return courseScheduleMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除课程排课信息
     * 
     * @param id 课程排课ID
     * @return 结果
     */
    @Override
    public int deleteCourseScheduleById(Long id)
    {
        return courseScheduleMapper.deleteById(id);
    }
}
